home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 201-220 / scopedisk214 / skeleton / public.c < prev    next >
C/C++ Source or Header  |  1995-03-19  |  2KB  |  71 lines

  1. /*
  2.  * public.c - Public functions for skeleton class
  3.  *
  4.  * Public Domain
  5.  *
  6.  * Christian E. Hopps.
  7.  *
  8.  */
  9.  
  10. #include <skeleton_internal.h>
  11. #include <skeleton.h>
  12. #include <proto/intuition.h>
  13.  
  14. /* set this to true if you have registered your class with CATS   */
  15. /* #define SKELETON_PUBLIC                                        */
  16.  
  17. /* if your class is public (registered with CATS) this would be a */
  18. /* null-terminated string to identify your class. ie."imageclass" */
  19. #define SKELETON_ID (NULL)
  20.  
  21. /* this needs to be a null-terminated string that identfies your  */
  22. /* public superclass, other wise you need to pass a pointer to    */
  23. /* class when you call make class.                                */
  24. #define SUPERCLASS_ID ("rootclass")
  25.  
  26. /* this would be equal to the size of your instance data that the */
  27. /* "rootclass" should allocate for you.                           */
  28. #define SKELETON_INSTANCE_SIZE (0L)
  29.  
  30. #define SKELETON_FLAGS (0L)
  31.  
  32.  
  33. Class * Skeleton_init( void )
  34. {
  35.     Class *class;
  36.  
  37.     class = MakeClass(    SKELETON_ID,        /* your ID */
  38.                         SUPERCLASS_ID,        /* superclass string id. */
  39.                         NULL,                /* superclass ptr if not public */
  40.                         SKELETON_INSTANCE_SIZE, /* size of instance data */
  41.                         SKELETON_FLAGS );        /* flags (0L for now.) */
  42.  
  43.     if(class == NULL) {
  44.         return(NULL);
  45.     }
  46.     /*
  47.      * set up a pointer to the dispatcher function, if we had not used
  48.      * SAS/C __asm calling conventions with the dispatcher fucntion,
  49.      * we would have put an asembler stub routine in, that would then call
  50.      * the h_SubEntry.
  51.      */
  52.     class->cl_Dispatcher.h_Entry = Skeleton_dispatch;
  53.  
  54. #ifdef    SKELETON_PUBLIC
  55.     AddClass(class);
  56. #endif
  57.  
  58.     return(class);
  59. }
  60.  
  61.  
  62. ULONG   Skeleton_free( Class *class )
  63. {
  64.  
  65. #ifdef SKELETON_PUBLIC
  66.     RemoveClass(class);
  67. #endif
  68.  
  69.     return((ULONG) FreeClass(class) );
  70. }
  71.